package UnitTest.DataStructureTest.treeTest.binaryTreeTest.binaryTreeImplTest;

import DataStructure.tree.binaryTree.binaryTreeImpl.BinaryTreeImpl;
import TestData.DataStructureTestData.treeTestData.binaryTreeTestData.BinaryTreeBuildDemo;
import TestData.DataStructureTestData.treeTestData.binaryTreeTestData.BinaryTreeTestDemo;
import org.junit.Test;

/**
 * @author liujun
 * @date 2020-02-18 18:47
 * @description 二叉树 ： 判断两个二叉树相等
 */
public class BinaryTreeImplTest extends BinaryTreeTestDemo {

    BinaryTreeImpl binaryTreeDemo = new BinaryTreeImpl();

    @Test
    public void testequals() {
        assert binaryTreeDemo.equals(null, null);
        assert !binaryTreeDemo.equals(null, BinaryTreeBuildDemo.getBinaryTreeDemo3());
        assert !binaryTreeDemo.equals(BinaryTreeBuildDemo.getBinaryTreeDemo3(), null);
        assert !binaryTreeDemo.equals(null, BinaryTreeBuildDemo.getBinaryTreeDemo4());
        assert !binaryTreeDemo.equals(BinaryTreeBuildDemo.getBinaryTreeDemo4(), BinaryTreeBuildDemo.getBinaryTreeDemo5());
        assert binaryTreeDemo.equals(BinaryTreeBuildDemo.getBinaryTreeDemo5(), BinaryTreeBuildDemo.getBinaryTreeDemo5());
        assert binaryTreeDemo.equals(BinaryTreeBuildDemo.getBinaryTreeDemo6(), BinaryTreeBuildDemo.getBinaryTreeDemo6());
        assert !binaryTreeDemo.equals(BinaryTreeBuildDemo.getBinaryTreeDemo5(), BinaryTreeBuildDemo.getBinaryTreeDemo6());
    }

    @Test
    public void testequalsSingle() {
        assert !binaryTreeDemo.equals(null);
        assert !binaryTreeDemo.equals(BinaryTreeBuildDemo.getBinaryTreeDemo3());
        assert !binaryTreeDemo.equals(BinaryTreeBuildDemo.getBinaryTreeDemo4());
        binaryTreeDemo = BinaryTreeBuildDemo.getBinaryTreeDemo3();
        assert !binaryTreeDemo.equals(null);
        binaryTreeDemo = BinaryTreeBuildDemo.getBinaryTreeDemo4();
        assert !binaryTreeDemo.equals(BinaryTreeBuildDemo.getBinaryTreeDemo5());
        binaryTreeDemo = BinaryTreeBuildDemo.getBinaryTreeDemo5();
        assert binaryTreeDemo.equals(BinaryTreeBuildDemo.getBinaryTreeDemo5());
        assert !binaryTreeDemo.equals(BinaryTreeBuildDemo.getBinaryTreeDemo6());
        binaryTreeDemo = BinaryTreeBuildDemo.getBinaryTreeDemo6();
        assert binaryTreeDemo.equals(BinaryTreeBuildDemo.getBinaryTreeDemo6());
    }
}
